package com.huang.order.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.huang.api.service.UserService;
import com.huang.order.mapper.OrderMapper;
import com.huang.order.domain.Order;

import com.huang.order.service.OrderService;
import io.seata.spring.annotation.GlobalTransactional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
* @author freemudadmin
* @description 针对表【order】的数据库操作Service实现
* @createDate 2023-01-11 16:29:54
*/
@Service
public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order>
    implements OrderService {

    @Autowired
    UserService userService;

    @Override
    @GlobalTransactional
    public void seataTest() {

    }
    @GlobalTransactional
    @Override
    public void seataTest(Map map) throws Exception {
        userService.addUser((String) map.get("userName"),(Integer) map.get("age"));
        if ((Boolean) map.get("exception")){
            throw new Exception("exception");
        }
        this.save(new Order());
    }
}




